package com.devunion.bogdan.util;

import javax.imageio.ImageIO;
import java.net.URL;
import java.awt.*;
import java.io.IOException;

public class ImageHelper {

    private ImageHelper() {}

    public static Image getImage(String iconName) {
        URL resource = Image.class.getResource("/images/" + iconName);

        if (resource == null) {
            System.err.println("Can't load icon: " + iconName);
            return null;
        }

        try {
            return ImageIO.read(resource);
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        return null;
    }
}
